import { VxeGridPropTypes } from "vxe-table/types/grid";

export const columns: VxeGridPropTypes.Columns = [
  {type: 'checkbox', width: 50, fixed: 'left',},
  {type: 'seq', title: '序号', treeNode: true, width: 60,},
  {field: 'ID', title: 'ID', width: 60, visible: false,},
  {field: 'name', title: '按钮名称', visible: true, sortable: false, minWidth: 120,},
  {field: 'icon', title: '图标', visible: true, sortable: false, width: 120, 
  // cellRender: {events: ({row}) => {
  //   return <Icon icon={row.meta.icon}/>
  // }},
  },
  {field: 'place', title: '按钮位置', visible: true, sortable: false, minWidth: 120,
  formatter: ({cellValue,}) => {
    let result = '未知'
    switch(cellValue) {
      case 0: result = '表格上方-左边'; break;
      case 1: result = '表格上方-右边'; break;
      case 2: result = '表格内-操作'; break;
      case 3: result = '其他'; break;
    }
    return result;
  },
  },
  {field: 'func', title: '调用的方法名', visible: true, sortable: false, width: 130,},
  {field: 'sort', title: '顺序', visible: true, sortable: false, width: 60,},
  {field: 'selectedCount', title: '选中数量', visible: true, sortable: false, maxWidth: 100, 
  titlePrefix: {content: '显示表格行被选中的数量',},
  formatter: ({cellValue,}) => {
    let result = '未知'
    switch(cellValue) {
      case 0: result = '不显示';break;
      case 1: result = '显示';break;
    }
    return result;
  },},
  {field: 'tip', title: '是否提示', visible: true, sortable: false, width: 70,},
  {field: 'tipContent', title: '提示内容', visible: true, sortable: false, maxWidth: 150,},
  {field: 'otherConf', title: '其他配置', visible: true, sortable: false, maxWidth: 140,},
  {field: 'memo', title: '备注', visible: true, sortable: false, minWidth: 120,},
  {field: 'creator.name', title: '创建人', visible: false, sortable: false,},
  {field: 'CreatedAt', title: '创建时间', visible: false, sortable: false,},
  {field: 'UpdatedAt', title: '更新时间', visible: false, sortable: false,},
];

//
export interface NameValue {
  label: string,
  value: string,
}

export const nameOptions = [
  {value: 'seeDetails', label: '详情',},
  {value: 'create', label: '新增',},
  {value: 'edit', label: '编辑',},
  {value: 'batchDelete', label: '删除',},
  {value: 'copy', label: '复制行',},
  {value: 'grant', label: '授权',},
  {value: 'verify', label: '审核',},
  {value: 'unVerify', label: '弃审',},
  {value: 'close', label: '关闭',},
  {value: 'toVoid', label: '作废',},
  {value: 'invtIn', label: '入库',},
  {value: 'invtBatchIn', label: '批量入库',},
  {value: 'invtOut', label: '出库',},
  {value: 'invtBatchOut', label: '批量出库',},
];

export const placeOptions = [
  {value: 0, label: '表格-左上',},
  {value: 1, label: '表格-右上',},
  {value: 2, label: '表格内-操作',},
  {value: 3, label: '其他',},
];
